package com.dhcc.bpm.modules.scf.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dhcc.bpm.common.segmentId.LocalCacheIdGenerator;
import com.dhcc.bpm.common.utils.StringUtils;
import com.dhcc.bpm.modules.scf.dto.ScfSubjectBasicInfoDTO;
import com.dhcc.bpm.modules.scf.entity.ScfOperationLogInfo;
import com.dhcc.bpm.modules.scf.entity.ScfSubjectBasicInfo;
import com.dhcc.bpm.modules.scf.enumUtil.ScfOperationLogInfoEnum;
import com.dhcc.bpm.modules.scf.mapper.ScfSubjectBasicInfoMapper;
import com.dhcc.bpm.modules.scf.service.HomePageService.IScfAddressInfoService;
import com.dhcc.bpm.modules.scf.service.IScfFileAttachmentInfoService;
import com.dhcc.bpm.modules.scf.service.IScfOperationLogInfoService;
import com.dhcc.bpm.modules.scf.service.IScfSubjectBasicInfoService;
import com.dhcc.bpm.modules.scf.util.ExcelUtil;
import com.dhcc.bpm.modules.scf.util.MapApiExampleUtil;
import com.dhcc.bpm.modules.scf.util.OBSUtil;
import com.dhcc.bpm.modules.scf.vo.ScfFileAttachmentInfoVO.ScfFileAttachmentInfoVO;
import com.dhcc.bpm.modules.scf.vo.ScfSubjectBasicInfoVO.ScfGetSubjectDetailsVO;
import com.dhcc.bpm.modules.scf.vo.ScfSubjectBasicInfoVO.ScfGetSubjectListVO;
import com.dhcc.bpm.modules.system.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@Service
@Slf4j
public class ScfSubjectBasicInfoServiceImpl extends ServiceImpl<ScfSubjectBasicInfoMapper, ScfSubjectBasicInfo> implements IScfSubjectBasicInfoService {
    /**
     * 文件附件service接口
     */
    @Autowired
    private IScfFileAttachmentInfoService scfFileAttachmentInfoService;
    /**
     * id生成器
     */
    @Autowired
    private LocalCacheIdGenerator localCacheIdGenerator;
    /**
     * 操作日志service接口
     */
    @Autowired
    private IScfOperationLogInfoService scfOperationLogInfoService;
    /**
     * 地区信息服务service接口
     */
    @Autowired
    private IScfAddressInfoService scfAddressInfoService;
    /**
     * 用户信息service接口
     */
    @Autowired
    private IUserService userService;
    /**
     * 华为云obs工具类
     */
    @Autowired
    private OBSUtil obsUtil;

    /**
     * 主体信息列表查询
     *
     * @param page
     * @param scfSubjectBasicInfo
     * @return
     */
    @Override
    public IPage<ScfGetSubjectListVO> selectScfSubjectBasicInfoPage(IPage<ScfGetSubjectListVO> page, ScfSubjectBasicInfoDTO scfSubjectBasicInfo) {
        List<ScfGetSubjectListVO> scfGetSubjectLis = baseMapper.selectScfSubjectBasicInfoPage(page, scfSubjectBasicInfo);
        if (scfGetSubjectLis.size() != 0) {
            for (ScfGetSubjectListVO item : scfGetSubjectLis) {
                // 设置该主体的贸易总额
                item.setTotalSalesAmount(baseMapper.selectTotalSalesAmount(item.getSubNum()));
                List<Long> ids = new ArrayList<>();
                ids.add(Long.valueOf(item.getRecorder()));
                // 根据用户id查询用户名称，重新赋值登记人字段
                List<String> usernames = userService.selectUserNameByIds(ids);
                if(usernames.size()>0){
                    item.setRecorder(usernames.get(0));
                }

            }
        }
        return page.setRecords(scfGetSubjectLis);
    }

    /**
     * 查询主体信息详情
     *
     * @param scfSubjectBasicInfo
     * @return
     */
    @Override
    public ScfGetSubjectDetailsVO getDetails(ScfSubjectBasicInfoDTO scfSubjectBasicInfo) {
        ScfGetSubjectDetailsVO details = baseMapper.getDetails(scfSubjectBasicInfo.getRowId());
        if (details != null) {
            // 设置关联附件文件信息
            List<ScfFileAttachmentInfoVO> scfFileAttachmentInfoVOS = scfFileAttachmentInfoService.selectAllByAssociationId(details.getRowId());
            details.setFileAttachmentInfoVOS(scfFileAttachmentInfoVOS);
            List<Long> ids = new ArrayList<>();
            ids.add(Long.valueOf(details.getRecorder()));
            // 根据用户id查询用户名称，重新赋值登记人字段
            details.setRecorder(userService.selectUserNameByIds(ids).get(0));
        }
        return details;
    }

    /**
     * 单个主体信息新增
     *
     * @param scfSubjectBasicInfo
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean saveSubjectBasic(ScfSubjectBasicInfoDTO scfSubjectBasicInfo) throws Exception {
        // 录入开始首先判断该主体是否已录入
        if (baseMapper.selectSubNumBySubName(scfSubjectBasicInfo.getSubName()) != null) {
            // 根据发票号码查询到了对应的记录rowId--则认为该支付回单已录入
            throw new Exception("主体：" + scfSubjectBasicInfo.getSubName() + "已录入，请勿重复录入！");
        }
        // 生成当前日期
        SimpleDateFormat date = new SimpleDateFormat("YYYYMMdd");
        String formatDate = date.format(new Date());
        // 生成当前时间
        SimpleDateFormat time = new SimpleDateFormat("HHmmss");
        String formTime = time.format(new Date());
        // 生成当前日期时间
        Calendar calendar = Calendar.getInstance();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd :hh:mm:ss");
        String recordTime = dateFormat.format(calendar.getTime());
        // 获取角色码（1.供应商，2.再生资源，3.利废企业）
        String subRole = scfSubjectBasicInfo.getSubRole();
        // 获取主体类型（1.个人/2.企业）
        String subType = scfSubjectBasicInfo.getSubType();
        // 组合主体编码--生成规则“类型码+角色码+YYYYMMDD+4位序号” -- 生成ROW_ID
        String rowId = "ZT" + subType + subRole + formatDate + formTime + localCacheIdGenerator.nextId();
        // 设置记录编号
        scfSubjectBasicInfo.setRowId(rowId);
        // 设置主体编号
        scfSubjectBasicInfo.setSubNum(rowId);
        // 设置地区代码
        // 调用接口查询地址的省份
        String addressInfo = MapApiExampleUtil.getAddressInfo(scfSubjectBasicInfo.getRegisteredAddr());
        if (addressInfo != null) {
            // 匹配 "市" 或 "区" 并捕获其之前的部分字符串
            Pattern pattern = Pattern.compile("^(.*?(省|市|区))");
            Matcher matcher = pattern.matcher(addressInfo);
            if (matcher.find()) {
                String matchedPart = matcher.group(1);
                String adcode = scfAddressInfoService.selectAdcodeByAdname(matchedPart);
                scfSubjectBasicInfo.setAdCode(adcode);
            }
        }
        // 设置登记日期
        scfSubjectBasicInfo.setRecordDate(formatDate);
        // 设置登记时间
        scfSubjectBasicInfo.setRecordTime(formTime);
        // 表中存储主体信息
        boolean isSave = save(scfSubjectBasicInfo);
        List<String> rowIds = scfSubjectBasicInfo.getRowIds();
        // 设置主体相关附件存放路径
        String path = "ZT" + "/" + rowId + "/";
        if (rowIds != null) {
            if (rowIds.size() != 0) {
                if (isSave) {
                    for (String fileRowId : rowIds) {
                        // 根据文件id获取文件的临时objectKey
                        String objectKeyOfTemp = scfFileAttachmentInfoService.getFilePath(fileRowId,null);
                        // 截取文件的名称
                        String extractFileName = obsUtil.extractFileName(objectKeyOfTemp);
                        // 拼接正式的objectKey
                        String objectKey = path + extractFileName;
                        // 将附件文件从临时目录转移至正式目录
                        obsUtil.copyFile(objectKey, objectKeyOfTemp);
                        scfFileAttachmentInfoService.updateFilePath(fileRowId, objectKey);
                    }
                }
            }
            scfFileAttachmentInfoService.batchUpdateField(rowIds, rowId);
        }
        // 记录操作日志
        ScfOperationLogInfo scfOperationLogInfo = new ScfOperationLogInfo();
        // 根据用户id查询用户名称，重新赋值登记人字段
        List<Long> ids = new ArrayList<>();
        ids.add(Long.valueOf(scfSubjectBasicInfo.getRecorder()));
        scfOperationLogInfo.setRecorder(userService.selectUserNameByIds(ids).get(0));
        scfOperationLogInfo.setOperationModule(ScfOperationLogInfoEnum.SUBJECT.getOperation());
        scfOperationLogInfo.setOperationFunction("主体信息维护");
        scfOperationLogInfo.setOperationType(ScfOperationLogInfoEnum.ADD.getOperation());
        scfOperationLogInfo.setOperationContent("新增一条主体信息，主体名称为：" + scfSubjectBasicInfo.getSubName() + "，主体编号为：" + scfSubjectBasicInfo.getSubNum());
        scfOperationLogInfo.setRecordDate(recordTime);
        // 判断主体信息是否新增成功
        if (isSave) {
            // 主体信息存储成功则记录操作日志
            scfOperationLogInfoService.saveOperationLogInfo(scfOperationLogInfo);
        }
        // 判断并录入完成，存入数据库
        return isSave;
    }

    /**
     * 批量导入新增主体
     * @param scfSubjectBasicInfos
     * @param operatorId
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    @Override
    public int bachSaveSubjectBasic(List<ScfSubjectBasicInfo> scfSubjectBasicInfos, String operatorId) {
        List<ScfSubjectBasicInfo> scfSubjectBasicInfoList = new ArrayList<>();
        List<ScfOperationLogInfo> scfOperationLogInfoList = new ArrayList<>();
        for (ScfSubjectBasicInfo scfSubjectBasicInfo : scfSubjectBasicInfos) {
            if(StringUtils.isEmpty( scfSubjectBasicInfo.getOrgCode() ) || StringUtils.isEmpty(scfSubjectBasicInfo.getSubName()  )){
                continue;
            }
            // 设置登记人ID
            scfSubjectBasicInfo.setRecorder(operatorId);
            // 按数据字典重新赋值
            // 主体角色
            String subRole = scfSubjectBasicInfo.getSubRole();
            if (subRole != null) {
                switch (subRole) {
                    case "供应商":
                        // 执行与 value1 匹配的代码块
                        scfSubjectBasicInfo.setSubRole("1");
                        break;
                    case "利废企业":
                        // 执行与 value2 匹配的代码块
                        scfSubjectBasicInfo.setSubRole("2");
                        break;
                    case "再生资源企业":
                        // 执行与 value2 匹配的代码块
                        scfSubjectBasicInfo.setSubRole("3");
                        break;
                    // 可以有更多的 case 分支
                    default:
                        // 如果没有任何 case 匹配，则执行 default 代码块
                        break;
                }
            }
            // 主体类型
            String subType = scfSubjectBasicInfo.getSubType();
            if (subType != null) {
                switch (subType) {
                    case "个人":
                        // 执行与 value1 匹配的代码块
                        scfSubjectBasicInfo.setSubType("1");
                        break;
                    case "企业":
                        // 执行与 value2 匹配的代码块
                        scfSubjectBasicInfo.setSubType("2");
                        break;
                    // 可以有更多的 case 分支
                    default:
                        // 如果没有任何 case 匹配，则执行 default 代码块
                        break;
                }
            }
            // 个体证件类型
            String idType = scfSubjectBasicInfo.getIdType();
            if (idType != null) {
                switch (idType) {
                    case "身份证":
                        // 执行与 value1 匹配的代码块
                        scfSubjectBasicInfo.setIdType("1000");
                        break;
                    case "护照":
                        // 执行与 value2 匹配的代码块
                        scfSubjectBasicInfo.setIdType("1001");
                        break;
                    case "统一社会信用代码":
                        // 执行与 value2 匹配的代码块
                        scfSubjectBasicInfo.setIdType("1006");
                        break;
                    case "工商注册号":
                        // 执行与 value2 匹配的代码块
                        scfSubjectBasicInfo.setIdType("1007");
                        break;
                    // 可以有更多的 case 分支
                    default:
                        // 如果没有任何 case 匹配，则执行 default 代码块
                        break;
                }
            }
            // 法人证件类型
            String legalIdType = scfSubjectBasicInfo.getLegalIdType();
            if (legalIdType != null) {
                switch (legalIdType) {
                    case "身份证":
                        // 执行与 value1 匹配的代码块
                        scfSubjectBasicInfo.setLegalIdType("1000");
                        break;
                    case "护照":
                        // 执行与 value2 匹配的代码块
                        scfSubjectBasicInfo.setLegalIdType("1001");
                        break;
                    // 可以有更多的 case 分支
                    default:
                        // 如果没有任何 case 匹配，则执行 default 代码块
                        break;
                }
            }
            // 企业类型
            String unitType = scfSubjectBasicInfo.getUnitType();
            if (unitType != null) {
                switch (unitType) {
                    case "有限责任公司":
                        // 执行与 value1 匹配的代码块
                        scfSubjectBasicInfo.setUnitType("4000");
                        break;
                    case "股份有限公司":
                        // 执行与 value2 匹配的代码块
                        scfSubjectBasicInfo.setUnitType("4001");
                        break;
                    case "个人独资":
                        // 执行与 value2 匹配的代码块
                        scfSubjectBasicInfo.setUnitType("4002");
                        break;
                    case "合伙企业":
                        // 执行与 value2 匹配的代码块
                        scfSubjectBasicInfo.setUnitType("4003");
                        break;
                    case "全民所有":
                        // 执行与 value2 匹配的代码块
                        scfSubjectBasicInfo.setUnitType("4004");
                        break;
                    // 可以有更多的 case 分支
                    default:
                        // 如果没有任何 case 匹配，则执行 default 代码块
                        break;
                }
            }
            // 默认设置为未认证状态
            scfSubjectBasicInfo.setSts("2");
            // 如果主体类型为1.个人
            if (scfSubjectBasicInfo.getSubType() == "1") {
                // 联系人名称为主体名称
                scfSubjectBasicInfo.setContacts(scfSubjectBasicInfo.getSubName());
                // 获取户籍地址设置给注册地址
                scfSubjectBasicInfo.setRegisteredAddr(scfSubjectBasicInfo.getHjAddr());
                scfSubjectBasicInfo.setAgency(scfSubjectBasicInfo.getQfjg());
            }
            // 设置地区代码
            // 调用接口查询地址的省份
            String addressInfo = MapApiExampleUtil.getAddressInfo(scfSubjectBasicInfo.getRegisteredAddr());
            if (addressInfo != null) {
                // 匹配 "市" 或 "区" 并捕获其之前的部分字符串
                Pattern pattern = Pattern.compile("^(.*?(省|市|区))");
                Matcher matcher = pattern.matcher(addressInfo);
                if (matcher.find()) {
                    String matchedPart = matcher.group(1);
                    String adcode = scfAddressInfoService.selectAdcodeByAdname(matchedPart);
                    scfSubjectBasicInfo.setAdCode(adcode);
                }
            }
            // 生成当前日期
            SimpleDateFormat date = new SimpleDateFormat("YYYYMMdd");
            String formatDate = date.format(new Date());
            // 生成当前时间
            SimpleDateFormat time = new SimpleDateFormat("HHmmss");
            String formTime = time.format(new Date());
            // 生成当前日期时间
            Calendar calendar = Calendar.getInstance();
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd :hh:mm:ss");
            String recordTime = dateFormat.format(calendar.getTime());
            // 获取角色码（1.供应商，2.再生资源，3.利废企业）
            // 获取主体类型（1.个人/2.企业）
            // 组合主体编码--生成规则“类型码+角色码+YYYYMMDD+4位序号” -- 生成ROW_ID
            String rowId = "ZT" + scfSubjectBasicInfo.getSubType() + scfSubjectBasicInfo.getSubRole() + formatDate + formTime + localCacheIdGenerator.nextId();
            // 设置记录编号
            scfSubjectBasicInfo.setRowId(rowId);
            // 设置主体编号
            scfSubjectBasicInfo.setSubNum(rowId);
            // 设置地区代码
            // 匹配 "市" 或 "区" 并捕获其之前的部分字符串
            Pattern pattern = Pattern.compile("^(.*?(省|市|区))");
            Matcher matcher = pattern.matcher(scfSubjectBasicInfo.getRegisteredAddr());
            if (matcher.find()) {
                String matchedPart = matcher.group(1);
                String adcode = scfAddressInfoService.selectAdcodeByAdname(matchedPart);
                scfSubjectBasicInfo.setAdCode(adcode);
            }
            // 设置登记日期
            scfSubjectBasicInfo.setRecordDate(formatDate);
            // 设置登记时间
            scfSubjectBasicInfo.setRecordTime(formTime);
            // 录入开始首先判断该主体是否已录入
            if (baseMapper.selectSubNumBySubName(scfSubjectBasicInfo.getSubName()) == null) {
                scfSubjectBasicInfoList.add(scfSubjectBasicInfo);
                // 记录操作日志
                ScfOperationLogInfo scfOperationLogInfo = new ScfOperationLogInfo();
                // 根据用户id查询用户名称，重新赋值登记人字段
                List<Long> ids = new ArrayList<>();
                ids.add(Long.valueOf(scfSubjectBasicInfo.getRecorder()));
                scfOperationLogInfo.setRecorder(userService.selectUserNameByIds(ids).get(0));
                scfOperationLogInfo.setOperationModule(ScfOperationLogInfoEnum.SUBJECT.getOperation());
                scfOperationLogInfo.setOperationFunction("主体信息维护");
                scfOperationLogInfo.setOperationType(ScfOperationLogInfoEnum.ADD.getOperation());
                scfOperationLogInfo.setOperationContent("新增一条主体信息，主体名称为：" + scfSubjectBasicInfo.getSubName() + "，主体编号为：" + scfSubjectBasicInfo.getSubNum());
                scfOperationLogInfo.setRecordDate(recordTime);
                scfOperationLogInfoList.add(scfOperationLogInfo);
            }
        }
        boolean saveBatch = saveBatch(scfSubjectBasicInfoList);
        if (saveBatch) {
            scfOperationLogInfoService.bachSaveOperationLogInfo(scfOperationLogInfoList);
        }
        return scfSubjectBasicInfoList.size();
    }

    /**
     * 更新主体信息（个人/企业）
     *
     * @param scfSubjectBasicInfo
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean updateSubjectBasic(ScfSubjectBasicInfoDTO scfSubjectBasicInfo) {
        // 生成年月日
        SimpleDateFormat date = new SimpleDateFormat("YYYYMMdd");
        String formatDate = date.format(new Date());
        // 生成时分秒
        SimpleDateFormat time = new SimpleDateFormat("HHmmss");
        String formTime = time.format(new Date());
        // 获取当前年月日时分秒
        Calendar calendar = Calendar.getInstance();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd :hh:mm:ss");
        String recordTime = dateFormat.format(calendar.getTime());
        // 重新更新登记日期
        scfSubjectBasicInfo.setRecordDate(formatDate);
        // 重新设置地区代码
        // 调用接口查询地址的省份
        String addressInfo = MapApiExampleUtil.getAddressInfo(scfSubjectBasicInfo.getRegisteredAddr());
        if (addressInfo != null) {
            // 匹配 "市" 或 "区" 并捕获其之前的部分字符串
            Pattern pattern = Pattern.compile("^(.*?(省|市|区))");
            Matcher matcher = pattern.matcher(addressInfo);
            if (matcher.find()) {
                String matchedPart = matcher.group(1);
                String adcode = scfAddressInfoService.selectAdcodeByAdname(matchedPart);
                scfSubjectBasicInfo.setAdCode(adcode);
            }
        }
        // 设置完成 更新数据库
        boolean update = updateById(scfSubjectBasicInfo);
        // 获取当前记录的rowId
        String rowId = scfSubjectBasicInfo.getRowId();
        // 获取附件文件id集合
        List<String> rowIds = scfSubjectBasicInfo.getRowIds();
        if (rowIds != null) {
            if (rowIds.size() != 0) {
                // 设置主体相关附件存放路径
                String path = "ZT" + "/" + rowId + "/";
                if (rowId != null) {
                    // 取消旧文件与记录关联
                    scfFileAttachmentInfoService.updataFiledNull(rowId);
                    // 给上传的新文件添加关联编号
                    scfFileAttachmentInfoService.batchUpdateField(rowIds, rowId);
                    for (String fileRowId : rowIds) {
                        // 根据文件id获取文件的临时objectKey
                        String objectKeyOfTemp = scfFileAttachmentInfoService.getFilePath(fileRowId,null);
                        // 截取文件的名称
                        String extractFileName = obsUtil.extractFileName(objectKeyOfTemp);
                        // 拼接正式的objectKey
                        String objectKey = path + extractFileName;
                        // 将临时目录下的附件文件转移至正式目录
                        obsUtil.copyFile(objectKey, objectKeyOfTemp);
                        scfFileAttachmentInfoService.updateFilePath(fileRowId, objectKey);
                    }
                }
            }
        }
        // 记录操作日志
        ScfOperationLogInfo scfOperationLogInfo = new ScfOperationLogInfo();
        scfOperationLogInfo.setRowId("Log" + formatDate + formTime + localCacheIdGenerator.nextId());
        // 根据用户id查询用户名称，重新赋值登记人字段
        List<Long> ids = new ArrayList<>();
        ids.add(Long.valueOf(scfSubjectBasicInfo.getRecorder()));
        scfOperationLogInfo.setRecorder(userService.selectUserNameByIds(ids).get(0));
        scfOperationLogInfo.setOperationModule(ScfOperationLogInfoEnum.SUBJECT.getOperation());
        scfOperationLogInfo.setOperationFunction("主体信息维护");
        scfOperationLogInfo.setOperationType(ScfOperationLogInfoEnum.UPDATE.getOperation());
        scfOperationLogInfo.setOperationContent("更新一条主体信息，主体名称为：" + scfSubjectBasicInfo.getSubName() + "，主体编号为：" + scfSubjectBasicInfo.getSubNum());
        scfOperationLogInfo.setRecordDate(recordTime);
        // 判断更新主体记录是否成功
        if (update) {
            // 更新主体记录成功则记录操作日志
            scfOperationLogInfoService.saveOperationLogInfo(scfOperationLogInfo);
        }
        return update;
    }

    /**
     * 批量解析Excel文件导入数据
     *
     * @param file
     * @return
     * @throws IOException
     */
    @Override
    public List<ScfSubjectBasicInfo> batchSaveSubjectBasic(String operatorId, MultipartFile file) throws IOException {
        // 获取文件的Base64编码
        byte[] fileBytes = file.getBytes();
        // 解析excel文件获取数据集合
        List<ScfSubjectBasicInfo> scfSubjectBasicInfos;
        List<ScfSubjectBasicInfo> scfSubjectBasicInfosFinal = new ArrayList<>();
        List<String> subTypes = new ArrayList<>();
        subTypes.add("主体信息（企业）");
        subTypes.add("主体信息（个人)");
        for (int i = 0; i <= subTypes.size() - 1; ) {
            scfSubjectBasicInfos = ExcelUtil.readExcel(fileBytes, ScfSubjectBasicInfo.class, subTypes.get(i), 3);
            for (int j = 0; j <= scfSubjectBasicInfos.size() - 1; ) {
                scfSubjectBasicInfosFinal.add(scfSubjectBasicInfos.get(j));
                j++;
            }
            i++;
        }
        log.info("数据集合为：{}", scfSubjectBasicInfosFinal);
        return scfSubjectBasicInfosFinal;
    }

    @Override
    public Boolean deleteByIds(String[] ids) {
        return this.baseMapper.deleteByIds(ids);
    }
}
